// pages/destination/destination.js
const http = require("../../utils/http");
Page({

    /**
     * 页面的初始数据
     */
    data: {
        zhouArr: [{
                id: 1,
                name: "欧洲",
                key: "Europe"
            },
            {
                id: 2,
                name: "亚洲",
                key: "Asia"
            },
            {
                id: 3,
                name: "非洲",
                key: "Africa"
            },
            {
                id: 4,
                name: "大洋洲",
                key: "Oceania"
            },
            {
                id: 5,
                name: "南美洲",
                key: "SouthAmerica"
            },
            {
                id: 6,
                name: "北美洲",
                key: "NorthAmerica"
            },
        ],
        zhouName: "欧洲",
        zhouKey: "Europe",
        zhouId: 1,
        hotlist: [],
        otherlist: [],
    },
    changeZhou(ev) {
        console.log(ev);
        const {
            id,
            key,
            name
        } = ev.currentTarget.dataset;
        this.setData({
            zhouName: name,
            zhouKey: key,
            zhouId: id
        })
        this.getZhouData();
    },
    getZhouData() {
        http.request("product/desc/CountryList/" + this.data.zhouName + "/" + this.data.zhouKey, "", "get").then(res => {
            console.log(res);
            this.setData({
                hotlist: res.data.hot_country_list
            })
            this.setData({
                otherlist: res.data.other_country_list
            })
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
       this.getZhouData()
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})